#include<stdio.h>
int main(void)
{
    int work_year,hour;
    double salary;

    scanf("%d %d",&work_year,&hour);

    if(work_year<5){
          if(hour<=40)
          {   
          salary=hour*30;
          printf("%.2lf",salary);
          }
          else
          {
          salary=1200+(hour-40)*45;
          printf("%.2lf",salary);
          }
    }
          else if(work_year>=5&&hour<=40)
          {
              printf("%.2lf",hour*50.0);
          }else 
          printf("%.2lf",2000+(hour-40)*75.0);

          return 0;
}